package com.example.demo.model.index.index.contoller;

import com.example.demo.Results.ResultClass;
import com.example.demo.model.goods.goods.entity.ShopGoods;
import com.example.demo.model.goods.goods.service.ShopGoodsService;
import com.example.demo.model.index.index.service.IndexService;
import com.example.demo.model.user.user.entity.ShopUser;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

@RestController
@RequestMapping("/index/login")
public class LoginResource {
    @Autowired
    IndexService indexService;

    @Autowired
    ShopGoodsService shopGoodsService;

    @GetMapping("login")
    public ModelAndView login() {
        return indexService.login();
    }

    @PostMapping("/doLogin")
    public ResultClass doLogin(HttpServletRequest request, ShopUser shopUser){
        return indexService.doLogin(request,shopUser);
    }


}

